package com.example;

import org.junit.jupiter.api.Test;

import java.lang.reflect.Method;


public class JdkProxyDemo {

    @Test
    public void borrow() throws Exception{
        Method method = Payment.class.getDeclaredMethod("pay", Long.class);
        Payment p1 = new Payment() {
            @Override
            public void pay(Long amount) {
                System.out.println(amount);
            }
        };

        method.invoke(p1,10L);

    }

    interface Payment {

        void pay(Long amount);
    }

}
